package com.dqp.cslggroup.UI;

import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.dqp.cslggroup.R;
import com.dqp.cslggroup.bean.Kj;

import java.util.List;

public class KjAdapter extends BaseAdapter {

    private List<Kj> kjList;
    private LayoutInflater inflater;
    private KjAdapter kjAdapter;

    public KjAdapter(List<Kj> kj, Context context) {
        this.kjList = kj;
        this.inflater = LayoutInflater.from(context);
    }


    public int getCount() {
        return kjList == null ? 0 : kjList.size();
    }


    public Object getItem(int position) {
        return kjList.get(position);
    }


    public long getItemId(int position) {
        return position;
    }


    public View getView(int position, View convertView, ViewGroup parent) {
        @SuppressLint("ViewHolder") View view = inflater.inflate(R.layout.grade_list, null);
        Kj kj = (Kj) getItem(position);
        TextView kc = view.findViewById(R.id.text_kc);
        TextView xf = view.findViewById(R.id.text_xf);
        TextView cj = view.findViewById(R.id.text_cj);
        TextView jd = view.findViewById(R.id.text_jd);
        kc.setText(kj.getXmmc());
        xf.setText(kj.getXnmc());
        cj.setText(kj.getXqmmc());
        jd.setText(kj.getXmcj());
        return view;
    }


}
